<?php

namespace app\dao\system;

use app\dao\BaseDao;
use app\model\system\Application;

/**
 * app应用模块
 * Class ApplicationDao
 * @package app\dao\system
 */
class ApplicationDao extends BaseDao
{
    /**
     * 设置模型
     * @return string
     */
    protected function setModel(): string
    {
        return Application::class;
    }

    public function search(array $where = [], bool $search = true)
    {
        return $this->getModel()->where(!empty($where['name']), function ($query) use ($where) {
            $query->where('name', 'like', '%' . $where['name'] . '%');
        });
    }
}